/*
    kOTF Open Trace Format - a library for generating execution traces.
    Copyright 2012 Daniel K. O.

    kOTF is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    kOTF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with kOTF.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KOTF_EVENT_BUFFER_H
#define KOTF_EVENT_BUFFER_H

#include <kotf/Events.hpp>

namespace kotf {

    class StreamImpl;

    struct EventBuffer {
        
        static const unsigned capacity = 64 * 1024;

        size_t size;
        Event data[capacity];

        StreamImpl * streamImpl;

        EventBuffer(StreamImpl* s);

        void write();

        bool add(const Event& e);

        void reset(StreamImpl *s);
    };

}

#endif
